package ru.vsu.amm.scenes.utils;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

/**
 * User: Saksonov Andrey <saksonov@amm.vsu.ru>
 * Date: 22.12.12
 * Time: 14:10
 */
public class DrawableDataReader {

    public static final String DATA = "data";

    public static double[][] readData(String file) throws IOException {
        Path path = FileSystems.getDefault().getPath(DATA, file);
        List<String> strings = Files.readAllLines(path, Charset.defaultCharset());
        double[][] result = new double[strings.size()][3];
        for (int i = 0; i < strings.size(); i++) {
            result[i][0] = Double.valueOf(strings.get(i).split(" ")[0]);
            result[i][1] = Double.valueOf(strings.get(i).split(" ")[1]);
            result[i][2] = Double.valueOf(strings.get(i).split(" ")[2]);
        }
        return result;
    }
}
